package com.genius.unite_platform.storedevice.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONArray;
import com.genius.adminmanager.other.entity.ResponseJson;
import com.genius.adminmanager.user.entity.UserJson;
import com.genius.unite_platform.storedevice.entity.StoreDeviceEntity;
import com.genius.unite_platform.storedevice.service.StoreDeviceServiceAdapter;
import com.genius.workflow.util.ConnectionException;
import com.genius.workflow.util.DBClosedException;
import com.genius.workflow.util.DBTools;
import com.genius.workflow.util.DBTools2;

import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;

@Service("StoreDeviceDeleteService")
public class StoreDeviceDeleteServiceImpl extends  StoreDeviceServiceAdapter  {

	@Override
	public JSONObject batchdel(JSONObject json, JSONObject response) {		
				
		String whereField =StoreDeviceEntity.storeno;		
    	String delTable = "storedevice";
    	System.out.println(whereField);
    	System.out.println(json);
    	
    	try {    		  		
			DBTools.delete(whereField, delTable,json);
			response.put(ResponseJson.status, ResponseJson.status_Success);
			response.put(ResponseJson.msg, ResponseJson.msg_Del_Data_Success);
		}  catch (ConnectionException e) {
			response.put(ResponseJson.status, ResponseJson.status_Failed);
    		response.put(ResponseJson.msg, ResponseJson.msg_No_Porwer_Query_Field);
		} catch (DBClosedException e) {
			response.put(ResponseJson.status, ResponseJson.status_Failed);
    		response.put(ResponseJson.msg, ResponseJson.msg_DB_Closed_Failed);
		} catch (SQLException e) {
			response.put(ResponseJson.status, ResponseJson.status_Failed);
			response.put(ResponseJson.msg, ResponseJson.msg_Del_Data_Error);
		}
		return response;
	}

}


	